<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * render aria and drop arrow for menubutton
 * @ignore
 * @author yiminghe@gmail.com
 */
KISSY.add(&quot;menubutton/render&quot;, function (S, Button,
                                         MenuButtonTpl,
                                         ContentRenderExtension) {

    return Button.getDefaultRender().extend([ContentRenderExtension], {

        decorateDom: function (el) {
            var control = this.control,
                prefixCls = control.get('prefixCls');
            var popupMenuEl = el.one('.' + prefixCls + 'popupmenu');
            var docBody = popupMenuEl[0].ownerDocument.body;
            docBody.insertBefore(popupMenuEl[0], docBody.firstChild);
            var PopupMenuClass =
                this.getComponentConstructorByNode(prefixCls, popupMenuEl);
            control.setInternal('menu', new PopupMenuClass({
                srcNode: popupMenuEl,
                prefixCls: prefixCls
            }));
        },

        beforeCreateDom: function (renderData) {
            S.mix(renderData.elAttrs, {
                'aria-expanded': false,
                'aria-haspopup': true
            });
        },

        _onSetCollapsed: function (v) {
            var self = this,
                el = self.$el,
                cls = self.getBaseCssClass(&quot;open&quot;);
            el[v ? 'removeClass' : 'addClass'](cls).attr(&quot;aria-expanded&quot;, !v);
        }
    }, {
        ATTRS: {
            contentTpl: {
                value: MenuButtonTpl
            }
        }
    });
}, {
    requires: ['button',
        './menubutton-xtpl',
        'component/extension/content-render']
});</pre>
</body>
</html>
